package top.uuei.thymeleaf.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.HttpMediaTypeException;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.UUID;

/**
 * @Controller不能页面跳转
 * @RestController返回json
 */
@Controller
public class HelloController {


    @GetMapping("/hello")
    public String hello(HttpServletRequest request){
        //默认找templates下的东西
        request.setAttribute("userName","UUEI");
        request.setAttribute("h1id", UUID.randomUUID().toString().substring(0,4));
        request.setAttribute("mycolor","color:blue");
        return "success";
    }
}
